<%@ page language="java" pageEncoding="UTF-8" contentType="text/html;charset=UTF-8" %>
<%@ include file="/resources/modular/plugin/taglibs.jsp" %>
<!doctype html>
<head content="-修改登录密码">
    <%@ include file="/resources/modular/head/inside_factory_head.jsp" %>
</head>
<body class="GC_Menu_5" name="GC_changeloginpass">
<%@ include file="/resources/modular/plugin/mainFactoryMenu.jsp" %>
<div class="loading"></div>
<div class="page" name="GC_changeloginpass">

    <%@ include file="/resources/modular/plugin/mainFactoryTopMenu.jsp" %>
    <%@ include file="/resources/modular/plugin/systemsetupMeun.jsp" %>
    <div class="page_line"></div>

    <div class="page_right settingspage_right">

        <%@ include file="/resources/modular/plugin/FcatoryGetMobileCode.jsp" %>

        <div class="settings_setpsdNext" id="GC_securitity_next" style="display:none;">
            <p><span>旧密码：</span>
                <input class="settings_loginpsd_psd" type="password" placeholder="请输入旧密码">
                <span class="settings_loginpsd_point" id="GC_CHANGEPASS_OLDPASSWORD_MSG">*密码错误</span>
            </p>
            <p><span>新密码：</span>
                <input class="settings_loginpsd_setpsd" type="password" placeholder="请输入新密码">
                <span class="settings_loginpsd_point" id="GC_CHANGEPASS_NEWPASSWORD_MSG">*密码错误</span>
            </p>
            <p><span>确认密码：</span>
                <input class="settings_loginpsd_cfmpsd" type="password" placeholder="请确认新密码">
                <span class="settings_loginpsd_point">*密码错误</span>
            </p>
            <div><input type="button" class="settings_psdConfirmbtn" disabled="disabled" value="确认"></div>
        </div>
    </div>

</div>
</body>
</html>
<%@ include file="/resources/modular/foot/inside_factory_footer.jsp" %>
<script type="text/javascript" src="${basePath}resources/js/v2/youyicloud-md5.js"></script>
<script type="application/javascript">

    var clickChangeFlag = false;

    function changloginpass() {

        if (clickChangeFlag) {
            alert("不能重复点击");
            return false;
        }

        var mobilecode = $(".settings_codeinput").val();
        var oldpassword = $(".settings_loginpsd_psd").val();
        var newpassword = $(".settings_loginpsd_setpsd").val();
        if (typeof(oldpassword) == "undefined" || oldpassword.length <= 0) {
            $("#GC_CHANGEPASS_OLDPASSWORD_MSG").text("旧密码不能为空").show();
        } else if (typeof(newpassword) == "undefined" || newpassword.length <= 0) {
            $("#GC_CHANGEPASS_NEWPASSWORD_MSG").text("新密码不能为空").show();
        } else {
            $.ajax({
                url: '${basePath}v2/factory/systemsetup/changeloginpassword',
                type: 'POST',
                data: {
                    "mobileCode": mobilecode,
                    "oldpassword": createPassword(oldpassword, oldpassword),
                    "newpassword": createPassword(newpassword, newpassword)
                },
                beforeSend: function () {
                    //关闭所有消息提醒
                    $("#GC_CHANGEPASS_OLDPASSWORD_MSG").hide();
                    $("#GC_CHANGEPASS_NEWPASSWORD_MSG").hide();
                },
                error: function (response) {
                    $errorMsg(response);
                },
                success: function (ret) {
                    if (ret.result) {
                        alert("修改登录密码成功", "cur");
                    } else {
                        if(ret.ERROR == "NEWPASS"){
                            $("#GC_CHANGEPASS_NEWPASSWORD_MSG").text(ret.info).show();
                        }else if(ret.ERROR == "OLDPASS"){
                            $("#GC_CHANGEPASS_OLDPASSWORD_MSG").text(ret.info).show();
                        }else{
                            alert(ret.info);
                        }

                    }
                }
            });
        }
    }

</script>